package Test;

import domain.PassWord;

import java.util.Scanner;


public class PassWordinsure {
//    public domain.PassWord(String a, String b) {

//    }
    PassWord[] pwd = new PassWord[1];

    Scanner sc = new Scanner(System.in);

//    domain.PassWord password = new domain.PassWord();
    PassWord password1 = new PassWord();
    String username;
    String password;
    public PassWordinsure(String a, String b) {
        this.username=a;
        this.password=b;
    }




    public void begin() {

        for (int i =0;i<3;i++) {
            System.out.println("请输入用户名");

            password1.setUsernamein(sc.next());
            System.out.println("请输入密码");
            password1.setPasswordin(sc.next());
//        for (int i = 0; i < pwd.length(); i++) {
//            if (password) {
            pwd[0] = password1;

            insure();
        }
//            }
//        }

    }


    public void insure() {
        if (pwd[0].getUsernamein().equals(username)&&pwd[0].getPasswordin().equals(password)){
//        if (password1.usernamein.equals(username)&&password1.passwordin.equals(password)){
            System.out.println("密码正确");
            System.exit(0);

        }else{
            System.out.println("密码错误");
        }

    }


}
